<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改档案')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
    	
        <form class="form-horizontal m" id="form-study" th:object="${record}">
        	<input name="recordId" th:field="*{recordId}" type="hidden">
        	<div class="col-sm-12">
				<blockquote class="text-warning" style="font-size:16px">
					[[${topic.topicName}]]
					<br/>
					<div class="col-sm-4">
	            		<label>中心号：[[${record.centerNo}]]</label>
	            	</div>
	            	<div class="col-sm-4">
	            		<label>筛选号：[[${record.screeningNo}]]</label>
	            	</div>
	            	<div class="col-sm-4">
	            		<label>随机号：[[${record.randomNo}]]</label>
	            	</div>
				</blockquote>
			</div>
            
            <h4 class="form-header h4">临床研究观察流程图</h4>
            <div class="row">
                <div class="col-sm-12 table-striped">
                	<table id="bootstrap-table" class="table table-striped table-advance table-hover">
                		<thead>
               				<tr th:each="tr:${topic.tr}">
                				<td th:each="td:${tr.td}" th:utext="${td.label}"></td>
               				</tr>
                		</thead>
                		<tbody>
                			<tr th:each="item:${topic.topicItemList}">
                				<td th:text="${item.itemTypeName}"></td>
                				
 								<th:block th:each="it:${item.detailList}">
	 								<td th:if="${it.detailStatus}==null">
	                				</td>
	                				<td th:if="${it.detailStatus}=='0'" th:onclick="'javascript:toMain('+${it.detailId}+')' "><i class="fa fa-square-o"></i>
	                				</td>
	                				<td th:if="${it.detailStatus}=='1'" th:onclick="'javascript:toMain('+${it.detailId}+')' "><i class="fa fa-check-square-o"></i>
	                				</td>
 								</th:block>
                			</tr>
                			<tr>
                				<td></td>
                				<td th:each="rp:${planList}">
                					<a class="btn" th:onclick="'javascript:exportPlan('+${rp.recordPlanId}+')'">导出</a>
                				</td>
                			</tr>
                		</tbody>
                	</table>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "kt/record";
        
        function toMain(detailId){
        	$("#form-study").attr('action',prefix+"/studyMain/"+detailId).submit();
        }
        
        function exportPlan(id){
        	$.modal.confirm("确定导出本次访视的数据吗？", function() {
        		var dataParam = $("#form-study").serializeArray();
                dataParam.push({ "name": "recordPlanId", "value": id });
                var url = prefix+"/export"
                $.modal.loading("正在导出数据，请稍后...");
                $.post(url, dataParam, function(result) {
                    if (result.code == web_status.SUCCESS) {
                        window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                    } else if (result.code == web_status.WARNING) {
                        $.modal.alertWarning(result.msg)
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                });
            });
        }
    </script>
</body>
</html>